<%@ page contentType="text/html;charset=UTF-8" language="java" session="true" %>
<%@ page import="com.zsoft.test.*" %>
<%@ page import=" javax.servlet.http.HttpSession" %>
<%@ taglib uri="http://displaytag.sf.net" prefix="display" %>

<% request.setAttribute("test", Dao.INSTANCE.listEvents()); %>

<html>
<head> 
	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> 
	<title>Home2phone</title> 
	<link rel="stylesheet" type="text/css" href="css/layout.css" /> 
	<link rel="stylesheet" type="text/css" href="css/displaytagex.css">
	<link rel="stylesheet" type="text/css" href="css/main.css">
</head> 
<body> 
 
	<div id="container"> 
 
		<div id="header"> 
			<h1>Home2phone - send events from your home to your phone</h1> 
			<p>Keep an eye on the house when you are away. Hook up your sensors to this servce and recieve notifications of events in your phone.</p>
			<h2>This service is still in alpha and not for public use yet. </h2> 
		</div> 
 
		<div id="content">
		  	<div id="message">
			 
			  	<%  if(session.getAttribute("result")!=null && ((String)session.getAttribute("result"))!="") { %>
			  		<h1><%= (String)session.getAttribute("result") %></h1>
			  	<% 
			  		session.setAttribute("result", "");
			  		} else { %>
			  	<% } %>
		  	</div>
  	
			<h1>Latest events</h1>
			
			<div>
				<display:table name="test" pagesize="10" class="dataTable" />
			</div>
			
			<br/>
			<hr/>
			<h1>Add new event</h1>
		    <form action="/addevent" method="post">
				<div>
			    	<label for="sender">Sender</label>
					<select name="sender" id="sender"> 
					<option value="doorbell">Doorbell</option>
					<option value="firealarm">Fire alarm</option>
					<option value="lightswitch1">Lightswitch 1</option>
					<option value="lightswitch2">Lightswitch 2</option>
					<option value="lightswitch3">Lightswitch 3</option>
					<option value="lightswitch4">Lightswitch 4</option>
					<option value="lightswitch5">Lightswitch 5</option>
					</select>
				</div>
		  		<div>
		  			<label for="description">Description</label>
					<textarea id="description" name="description" rows="3" cols="60"></textarea>
				</div>
		  		<div>
		  			<label for="password">Password</label>
		  			<input id="password" type="password" name="password" />
		  		</div>
		  		<div><input type="submit" value="Add new" /></div>
		    </form>
		</div> 
 
		<div id="footer"> 
			<p>
				This is a Zsoft &copy production. 
			</p> 
		</div> 
	</div> 
 </body>
 </html>
